/**
 * @create 2022-04-09
 * @desc actions
 */

import { TableActions, TableActionItem } from '@src/components';
import { GetSearchTableRListItem, DeleteSearchTableItem } from '@src/api';

import { FC } from 'react';

interface ActionsProps {
  row: GetSearchTableRListItem;
}

export const Actions: FC<ActionsProps> = ({ row }) => {
  const actionItems: TableActionItem[] = [
    {
      text: '删除',
      confirm: {
        onClick: () => {
          return DeleteSearchTableItem({ ids: [row.id] });
        },
      },
    },
    {
      text: '编辑',
      onClick: () => {
        // TODO
      },
    },
  ];

  return <TableActions actions={actionItems} />;
};
